<?php
//
// SITEMAP.XML WRITER
// By Garry Conn
// Version 1.09.29.2012.0934
//
$sitemapurl = "<url>";
$sitemaploc = "<loc>";
$sitemaplocation = "http://$serverurl/$url.php";
$sitemaploc1 = "</loc>";
$sitemappri = "<priority>";
$sitemappriority = "1.0";
$sitemappri1 = "</priority>";
$sitemapcha = "<changefreq>";
$sitemapchange = "daily";
$sitemapcha1 = "</changefreq>";
$sitemapurl1 = "</url>";
$sitemapurlset = "\n</urlset>";
$sitemaplength_end_string = strlen($sitemapurlset);
$sitemapfp =
fopen("sitemap.xml","r+") or die("can't open file");
fseek($sitemapfp, -$sitemaplength_end_string, SEEK_END); 
fwrite ($sitemapfp, "\n".$sitemapurl."\n".$sitemaploc."".$sitemaplocation."".$sitemaploc1."\n".$sitemappri."".$sitemappriority."".$sitemappri1."\n".$sitemapcha."".$sitemapchange."".$sitemapcha1."\n".$sitemapurl1."".$sitemapurlset."\n");
      fclose($sitemapfp);
?>
